function ccR_Racials()

	-- Healing Racial
	if ccRS.Racial_Healing
	and ccrPlayerHealth() < 80 then
		ccrHealingRacial()
		return
	end

	-- Spell Casting Interuption Racial
	if ccRS.Racial_Spell_Interupt
	and ccrTargetIsCastingOrChanneling()
	then
		ccrInteruptRacial()
		return
	end

	-- DPS Racials in combat
	if ccRS.Racial_DPS
	and ccrPlayerIsInCombat()
	and ccrTargetIsWithinRanged()
	then
		if ccrPlayerIsMelee() and ccrTargetIsWithinMeleeRange() then ccrDPSRacial() end;
		if ccrPlayerIsRanged() and ccrTargetIsWithinRanged() then ccrDPSRacial() end;
		return
	end

	-- Debuff Racial in combat
	if ccRS.Racial_Debuff then ccrDebuffRacial() end	
end

function ccrDPSRacial()
	-- Ranged
	if ccrPlayerIsRanged()
	and ccrPlayerIsInCombat()
	and ccrTargetIsWithinRanged()
	then
		-- Blood Fury
		if SpellIsReady(20572) then
			ccrCast(20572)		
			return
		end
		-- Berserking
		if SpellIsReady(26297) then
			ccrCast(26297)
			return
		end
		-- Lifeblood
		if SpellIsReady(81708) then
			ccrCast(81708)
			return
		end
	end
	-- Melee
	if ccrPlayerIsMelee()
	and ccrPlayerIsInCombat()
	and ccrTargetIsWithinMeleeRange()
	then
		-- Blood Fury
		if SpellIsReady(20572) then
			ccrCast(20572)		
			return
		end
		-- Berserking
		if ccrSpellIsReady(26297) then
			ccrCast(26297)
			return
		end
		-- Lifeblood
		if ccrSpellIsReady(81708) then
			ccrCast(81708)
			return
		end
	end			
end

function ccrInteruptRacial()
	if ccrValidTarget()
	and ccrTargetDistance() <= 10
	then
		-- Arcane Torrent
		if ccrPlayerHasSpell(28730) 
		and ccrSpellIsReady(28730)
		then
			ccrCast(28730)
			return
		end;
		-- Warstomp
		if ccrPlayerHasSpell(20549) 
		and ccrSpellIsReady(20549)
		then
			ccrCast(20549)
			return
		end;
		-- Quaking Palm
		if ccrPlayerHasSpell(107079)
		and ccrSpellCanAttack(107079)
		then
			ccrCastAttack(107079)
			return
		end;
	end
end

function ccrHealingRacial()
	-- Gift of the Naaru
	if ccrPlayerHasSpell(28880)
	and ccrPlayerHealth() <= 80
	and SpellIsReady(28880)
	then
		ccrCast(28880)
	end
end

function ccrDebuffRacial()
	-- Stone form
	if ccrPlayerHasSpell(20594)
	and ccrSpellIsReady(20594)
	then
		for i = 0, 40 do
			vDebuff = {UnitDebuff("Player", i)}
			if vDebuff[1] ~= nil then
				if vDebuff[5] == "Poison"
				or vDebuff[5] == "Disease"
				or vDebuff[5] == "Bleed"
				and SpellIsReady("Stoneform")
				then
					ccrCast(20594)
					return
				end
			end
		end
	end
	-- Escape Artist
	if ccrPlayerHasSpell(20589)
	and SpellIsReady(20589)
	then
		local eventIndex = C_LossOfControl.GetNumEvents()
		while (eventIndex > 0) do
			local _, _, text = C_LossOfControl.GetEventInfo(eventIndex)
			if text == LOSS_OF_CONTROL_DISPLAY_ROOT 
			or text == LOSS_OF_CONTROL_DISPLAY_SNARE
			then
				ccrCast(20589)
				return
			end
			eventIndex = eventIndex - 1
		end

		if eventIndex == 0
		and HasFullControl() == nil
		then
			ccrCast(20589)
			return
		end
	end
	-- Every Man For Himself
	if ccrPlayerHasSpell(59752)
	and ccrSpellIsReady(59752) 
	then
		local eventIndex = C_LossOfControl.GetNumEvents()
		while (eventIndex > 0) do
			local _, _, text = C_LossOfControl.GetEventInfo(eventIndex)
			if text == LOSS_OF_CONTROL_DISPLAY_ROOT 
			or text == LOSS_OF_CONTROL_DISPLAY_SNARE
			or text == LOSS_OF_CONTROL_DISPLAY_STUN_MECHANIC
			or text == LOSS_OF_CONTROL_DISPLAY_STUN
			or text == LOSS_OF_CONTROL_DISPLAY_FEAR
			or text == LOSS_OF_CONTROL_DISPLAY_HORROR
			then
				ccrCast(59752)
				return
			end
			eventIndex = eventIndex - 1
		end
		if HasFullControl() == nil then
			ccrCast(59752)
			return
		end

	end
end